import { createRouter, createWebHashHistory } from "vue-router";

const router = createRouter({
  history: createWebHashHistory(),
  routes: [
    {
      path: "/",
      name: "Home",
      component: () => import("../views/Home.vue"),
    },
    {
      path: "/user",
      name: "User",
      component: () => import("../views/User.vue"),
    },
    {
      path: "/detail",
      name: "Detail",
      component: () => import("../views/Detail.vue"),
      meta: {
        needHideTabber: true, // 需要隐藏底部Tabber
      },
    },
    {
      path: "/list",
      name: "List",
      component: () => import("../views/List.vue"),
    },
    {
      path: "/cart",
      name: "Cart",
      component: () => import("../views/Cart.vue"),
    },
  ],
});

//路由前置守卫
router.beforeEach((to, from, next) => {
  console.log("beforeEach");
  next();
});

export default router;
